<template>
  <el-dialog
    title="文本签名"
    :visible.sync="dialogVisible"
    width="60%"
    append-to-body
    :before-close="handleClose"
    :close-on-click-modal="false"
    :close-on-press-escape="false"
  >
    <textSign v-model="signValue" />
    <template #footer>
      <el-button type="info" @click="handleClose">
        取 消
      </el-button>
      <el-button type="primary" @click="confirm">
        确 认
      </el-button>
    </template>
  </el-dialog>
</template>

<script>
import textSign from "./textSign";
import _ from "lodash";

export default {
  name: "WorkspaceJsonTextsignmodal",

  components: { textSign },

  props: {
    value: {
      type: [Boolean],
      default: false
    },
    modalData: {
      type: [Object],
      default: () => {
        return {};
      }
    },
    isUpdata: {
      type: [Boolean],
      default: false
    }
  },

  data() {
    return {
      dialogVisible: false,
      signValue: {}
    };
  },

  watch: {
    value(n) {
      this.dialogVisible = n;
      if (this.isUpdata) {
        this.signValue = _.cloneDeep(this.modalData);
      } else {
        this.signValue = {};
      }
    }
  },

  mounted() {},

  methods: {
    handleClose() {
      this.$emit("input", false);
    },
    confirm() {
      this.$emit("confirm", this.signValue);
    }
  }
};
</script>

<style lang="scss" scoped></style>
